Ok, I have clarified threads in my mind and hope to do the same in
yours. Point 4 is a summary and should clarify the example from class
yesterday.

1. A method that calls "notify" or "wait" MUST be "synchronized" in
order to prevent more than one thread from running that method at the
same time. And if a method is synchronized, only one thread may be
executing it at a time. e.g.
   public synchronized void switchTurn () {
      notify();
      try { wait(); } catch (Exception e) {}
   }

2. If a thread inside a synchronized method is "waiting," another thread
may execute that same method copy, since only one thread is genuinely
executing the method. e.g.
   public synchronized void switchTurn () {
      notify();
      try { wait(); } catch (Exception e) {} // while one is waiting
here, another may execute this.
   }

3. If a method inside a thread class is "synchronized," since both
thread objects have their own copy of the method, both can execute their
versions of the synchronized method at the same time. e.g.

class Player extends Thread {
   public void synchronized run () {
      try {
         wait(); // Multiple threads could reach this point and all be
waiting (and deadlocked)
                   // because each object of this class has its own run
method.
      } catch (Exception e) {}
   }
}

4. Therefore, to use notify and wait cleanly, be sure that only one
thread has access to the line of code performing the notify or wait at a
time. Make sure the method is synchronized and the threads share only
one copy of that method.

Does this clear things up? I'll go over it again after spring break, but
some of you may need the information sooner (or twice).
